<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
</head>
<body>
    


    <div class="root">
        {{name}}{{age}} 
        <main @click="jian()">111111</main>
    </div>
    <script>
        new Vue({
            el: '.root', //el（element）⽤于指定当前Vue实例为哪个容器服务，值通常为css选     择器字符串
            // el: document.getElementByClassName('root')
            data: { //data中⽤于存储数据，数据供el所指定的容器去使⽤，值 暂时先写成⼀个对象
                name: 'Eric',
                age: "23"
            },
            methods:{
                jian(){
                    this.data.age--   //年龄减，刷新页面
                    this.compile()
                },
                jia(){              
                    this.data.age++  //年龄加，刷新页面
                    this.compile()
                },
            }
        })




        // function fn(){
        //     alert("11")
        // }
    </script>
</body>
</html>